import {takeEvery,put} from 'redux-saga/effects'
import {loadProducts,saveProducts} from '../actions/product.actions'
import axios from 'axios'
function* handleProducts () {
  // 请求数据
  const {data} = yield axios.get('http://localhost:3005/goods')
  // 将本地数据存储到Store
  yield put(saveProducts(data))
}
export default function* productSaga (){
  // 加载商品列表数据
  yield takeEvery(loadProducts,handleProducts)
}